home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000110_kb@cs.umb.edu_Thu Dec 9 11:18:13 1993.msg < prev    next >
Internet Message Format  |  1994-10-11  |  6KB

  1. Received: from terminus.cs.umb.edu by cs.umb.edu with SMTP id AA10732
  2.   (5.65c/IDA-1.4.4 for <tex-k-exp@cs.umb.edu>); Thu, 9 Dec 1993 16:18:14 -0500
  3. Received: by terminus.cs.umb.edu id AA11232
  4.   (5.65c/IDA-1.4.4 for tex-k); Thu, 9 Dec 1993 16:18:13 -0500
  5. Date: Thu, 9 Dec 1993 16:18:13 -0500
  6. From: "K. Berry" <kb@cs.umb.edu>
  7. Message-Id: <199312092118.AA11232@terminus.cs.umb.edu>
  8. To: tex-k@cs.umb.edu
  9. Subject: revised MakeTeXPK.in
  10. Reply-To: kb@cs.umb.edu
  11.  
  12. Here is a revised MakeTeXPK. Untested of course :-(
  13. The Makefile's will do some substitutions on it, should be obvious what
  14. to do. (If not, don't bother trying it.)
  15.  
  16. If anyone has time & desire to test this out, I'd appreciate it.
  17. It includes the gsftopk support R.K. contributed, in a slightly revised
  18. form, and other cleanups/changes.
  19.  
  20. #!/bin/sh
  21. # original MakeTeXPK -- make a new PK font, because one wasn't found.
  22. # (If you change or delete the word `original' on the previous line,
  23. # installation won't write this MakeTeXPK over yours.)
  24. # Parameters:
  25. #
  26. #   name dpi bdpi magnification [mode]
  27. #
  28. #   `name' is the base name of the font, such as `cmr10'.
  29. #   `dpi' is the resolution the font is needed at.
  30. #   `bdpi' is the base resolution, used to intuit the mode to use.
  31. #   `magnification' is a string to pass to MF as the value of `mag'.
  32. #   `mode', if supplied, is the mode to use.
  33. #
  34. # This script must echo the name of the generated PK file (and nothing
  35. # else) to standard output. Yes, this is different from the original dvips.
  36.  
  37. echo "Running MakeTeXPK $*" 1>&2
  38.  
  39. # Where to put the new file. The Makefile substitutes for this value.
  40. : ${DESTDIR=@mtp_destdir@}
  41.  
  42. # Define to `gsftopk' or `ps2pk' or whatever to make PK files for
  43. # PostScript fonts. If this is defined, MAPFILE must also be defined to
  44. # be your psfonts.map file or some equivalent. The Makefile substitutes
  45. # for this, too.
  46. : ${gsftopk=""}
  47. : ${MAPFILE=@configdir@/psfonts.map}
  48.  
  49. # If this directory doesn't exist, the Sauter stuff won't be attempted.
  50. : ${sauterdir=/usr/local/src/TeX+MF/tex82/utilities/sauter}
  51.  
  52. # Likewise, for the F3 stuff.
  53. : ${f3dir=/groups/dtrg/typescaler/fonts/f3b}
  54.  
  55. # TEMPDIR needs to be unique for each process because of the possibility
  56. # of simultaneous processes running this script.
  57. TEMPDIR=/tmp/mtpk.$$
  58.  
  59. NAME=$1
  60. DPI=$2
  61. BDPI=$3
  62. MAG=$4
  63. MODE=$5
  64.  
  65. umask 0
  66.  
  67. GFNAME=$NAME.$DPI'gf'
  68. PKNAME=$NAME.$DPI'pk'
  69.  
  70. # Have we been spuriously called? No harm done, if so.
  71. if test -r $DESTDIR/$PKNAME; then
  72.   echo "$DESTDIR/$PKNAME already exists!" 1>&2
  73.   echo $DESTDIR/$PKNAME
  74.   exit 0
  75. fi
  76.  
  77. # Clean up on normal or abnormal exit.
  78. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  79.  
  80. # Do we have a GF file in the current directory?
  81. if test -r $GFNAME; then
  82.   echo "gftopk ./$GFNAME $PKNAME" 1>&2
  83.   gftopk ./$GFNAME $PKNAME
  84.   # Don't move the font; if the person knows enough to make fonts, they
  85.   # know enough to have . in the font paths.
  86.   echo $PKNAME
  87.   exit 0
  88. fi
  89.  
  90. # Do we have an F3 font?
  91. if test -r $f3dir/$NAME.f3b; then
  92.   # You will need Sun's f3tobm program, plus a program I wrote.
  93.   # See ftp.cs.umb.edu:private/f3totex.
  94.   cd $f3dir || exit 1
  95.   echo "f3topk -r $DPI $NAME" 1>&2
  96.   if f3topk -r $DPI $NAME; then
  97.     # Best if f3topk echoes its output filename, I think.
  98.     exit 0
  99.   else
  100.     echo "f3topk failed." 1>&2
  101.     exit 1
  102.   fi
  103. fi
  104.  
  105. # Is this a PostScript font?
  106. if test -n "$gsftopk" && egrep \^$NAME'([     ]|$)' $MAPFILE >/dev/null; then
  107.   echo "Running $gsftopk $NAME $DPI." 1>&2
  108.   if $gsftopk $NAME $DPI 1>&2; then
  109.     echo $NAME
  110.     exit 0
  111.   else
  112.     echo "$gsftopk failed."
  113.     exit 1
  114.   fi
  115. fi
  116.   
  117. # We're down to trying Metafont.  Since we want to run it in a
  118. # temporary directory, add the current directory to MFINPUTS.
  119. MFINPUTS=`pwd`:${MFINPUTS}:
  120. export MFINPUTS
  121.  
  122. test -d $TEMPDIR || mkdir $TEMPDIR 
  123. cd $TEMPDIR || exit 1
  124.  
  125. # Which version of Metafont shall we use?
  126. case $NAME in
  127.   cm*) mf=cmmf;;
  128.     *) mf=mf;;
  129. esac
  130.  
  131. # If an explicit mode is not supplied, try to guess. You can get a
  132. # complete list of extant modes from ftp.cs.umb.edu:pub/tex/modes.mf.
  133. if test -z "$MODE"; then
  134.   case "$BDPI" in
  135.     85) MODE=sun;;
  136.    118) MODE=lview;;
  137.    300) MODE=CanonCX;;
  138.    600) MODE=ljfour;;
  139.   1270) MODE=LinotypeOneZeroZero;;
  140.      *) echo "MakeTeXPK doesn't have a guess for $BDPI dpi devices." 1>&2
  141.         echo "Put the mode in a config file, or update MakeTeXPK." 1>&2
  142.         exit 1
  143.   esac
  144. fi
  145.  
  146. # Run Metafont. 
  147. echo "Running $mf \mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" 1>&2
  148. $mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null 1>&2
  149.  
  150. if test -d $sauterdir && test $? -eq 1 && test $mf = cmmf; then
  151.   echo "Trying interpolated/extrapolated (Sauter) CM source." 1>&2
  152.   # Perhaps no such MF source file, and it's CM.  Try Sauter's scripts.
  153.   cd $sauterdir
  154.   rootfont=`echo $NAME | sed 's/[0-9]*$//'`
  155.   pointsize=`echo $NAME | sed 's/^\(.*\)\([0-9]*\)$/\1/'`
  156.   make-mf $rootfont $pointsize
  157.   $mf "\mode:=$MODE; mag:=$MAG; scrollmode; input mf/$NAME" </dev/null
  158.   if test $? -eq 0 && test -r $GFNAME; then
  159.     mv $GFNAME $TEMPDIR
  160.   fi
  161.   rm -f $NAME.log mf/$NAME
  162.   cd $TEMPDIR
  163. fi
  164.  
  165. if test ! -r $GFNAME; then
  166.   # Maybe it succeeded at DPI +- 1?  Annoying to have to check for this,
  167.   # but it avoids some annoyances, so fine.
  168.   test_dpi=`expr $DPI - 1`
  169.   test_name=$NAME.${test_dpi}
  170.   if test -r ${test_name}gf; then
  171.     GFNAME=${test_name}gf
  172.     PKNAME=${test_name}pk
  173.   else
  174.     test_dpi=`expr $DPI + 1`
  175.     test_name=$NAME.${test_dpi}
  176.     if test -r ${test_name}gf; then
  177.       GFNAME=${test_name}gf
  178.       PKNAME=${test_name}pk
  179.     else
  180.       echo "MakeTeXPK failed to make $GFNAME." 1>&2
  181.       exit 1
  182.     fi
  183.   fi
  184. fi
  185.  
  186. # Metafont succeeded.  Make the PK file.
  187. gftopk ./$GFNAME $PKNAME
  188.  
  189. test -d $DESTDIR \
  190.   || mkdir $DESTDIR \
  191.   || (echo "${DESTDIR}: MakeTeXPK could not create directory." 1>&2; exit 1)
  192.  
  193. # Install the PK file carefully, since others may be working simultaneously.
  194. mv $PKNAME $DESTDIR/pktmp.$$ \
  195.   || (echo "$0: Could not mv $PKNAME $DESTDIR/pktmp.$$." 1>&2; exit 1)
  196.  
  197. cd $DESTDIR || exit 1
  198. mv pktmp.$$ $PKNAME
  199.  
  200. # If this line (or an equivalent) is not present, dvipsk/xdvik will think
  201. # MakeTeXPK failed.  Any other output to stdout will likewise lose.
  202. echo $DESTDIR/$PKNAME